package ru.isys.yoomee.model;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

public class Venue implements Serializable
{
    String nameOfVenue;
    int distanceToVenue;
    int latitude;
    int longitude;
    List <Yoo> checkinedYoos;
    
    public Venue (){
        this("",0);
    }
    public Venue (String nameOfVenue){
        this(nameOfVenue,0);
    }
    public Venue(String nameOfVenue, int distanceToVenue){
        this.nameOfVenue=nameOfVenue;
        this.distanceToVenue=distanceToVenue;
        this.checkinedYoos =new ArrayList<Yoo>();
    }
    public String getNameOfVenue()
    {
        return nameOfVenue;
    }
    public void setNameOfVenue(String nameOfVenue)
    {
        this.nameOfVenue = nameOfVenue;
    }
    public int getDistanceToVenue()
    {
        return distanceToVenue;
    }
    
    public String getDistanceToVenueString(){
        return this.distanceToVenue+" km"; 
    }
    public void setDistanceToVenue(int distanceToVenue)
    {
        this.distanceToVenue = distanceToVenue;
    }
    @Override
    public int hashCode()
    {
        final int prime = 31;
        int result = 1;
        result = prime * result + distanceToVenue;
        result = prime * result + ((nameOfVenue == null) ? 0 : nameOfVenue.hashCode());
        return result;
    }
    @Override
    public boolean equals(Object obj)
    {
        if (this == obj)
            return true;
        if (obj == null)
            return false;
        if (getClass() != obj.getClass())
            return false;
        Venue other = (Venue) obj;
        if (distanceToVenue != other.distanceToVenue)
            return false;
        if (nameOfVenue == null)
        {
            if (other.nameOfVenue != null)
                return false;
        }
        else if (!nameOfVenue.equals(other.nameOfVenue))
            return false;
        return true;
    }
    public List<Yoo> getCheckinedYoos()
    {
        return checkinedYoos;
    }
    public void setCheckinedYoos(List<Yoo> checkinedYoos)
    {
        this.checkinedYoos = checkinedYoos;
    }    
    public void addCheckinedYoo(Yoo yoo)
    {
        this.checkinedYoos.add(yoo);
    }
    public void removeCheckinedYoos(Yoo checkinedYoo)
    {
        this.checkinedYoos.remove(checkinedYoo);
    }
    public int getLatitude()
    {
        return latitude;
    }
    public void setLatitude(int latitude)
    {
        this.latitude = latitude;
    }
    public int getLongitude()
    {
        return longitude;
    }
    public void setLongitude(int longitude)
    {
        this.longitude = longitude;
    }    
    
}
